/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Table_online_saver;

import java.io.Serializable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Klu12
 */
@Entity
@Table(name = "contact_booking")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ContactBooking.findAll", query = "SELECT c FROM ContactBooking c"),
    @NamedQuery(name = "ContactBooking.findByIdContact", query = "SELECT c FROM ContactBooking c WHERE c.contactBookingPK.idContact = :idContact"),
    @NamedQuery(name = "ContactBooking.findByIdBooking", query = "SELECT c FROM ContactBooking c WHERE c.contactBookingPK.idBooking = :idBooking")})
public class ContactBooking implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected ContactBookingPK contactBookingPK;

    public ContactBooking() {
    }

    public ContactBooking(ContactBookingPK contactBookingPK) {
        this.contactBookingPK = contactBookingPK;
    }

    public ContactBooking(int idContact, int idBooking) {
        this.contactBookingPK = new ContactBookingPK(idContact, idBooking);
    }

    public ContactBookingPK getContactBookingPK() {
        return contactBookingPK;
    }

    public void setContactBookingPK(ContactBookingPK contactBookingPK) {
        this.contactBookingPK = contactBookingPK;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (contactBookingPK != null ? contactBookingPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ContactBooking)) {
            return false;
        }
        ContactBooking other = (ContactBooking) object;
        if ((this.contactBookingPK == null && other.contactBookingPK != null) || (this.contactBookingPK != null && !this.contactBookingPK.equals(other.contactBookingPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.ContactBooking[ contactBookingPK=" + contactBookingPK + " ]";
    }
    
}
